package com.xinqi.modules.sys.role.controller.admin;

import com.xinqi.common.base.constants.ServiceNameConstants;
import com.xinqi.common.base.response.R;
import com.xinqi.common.log.syslog.annotation.Log;
import com.xinqi.common.log.syslog.enums.BusinessType;
import com.xinqi.common.log.syslog.enums.OperatorType;
import com.xinqi.modules.sys.role.service.UserRoleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统用户角色WEB控制层
 *
 * @author: linkai
 * @date: 2023/04/01
 */
@Tag(name = "Admin-系统角色", description = "系统角色Admin接口")
@RestController
@RequestMapping("/admin/user-role")
@RequiredArgsConstructor
public class UserRoleWebController {
    private final UserRoleService userRoleService;

    /**
     * 删除系统用户角色
     */
    @Operation(summary = "删除系统用户角色")
    @DeleteMapping("/{id}")
    @Log(title = ServiceNameConstants.XQ_SYS + " -- 删除系统角色", businessType = BusinessType.DELETE, operatorType = OperatorType.MANAGE)
    public R<Boolean> delete(@Parameter(description = "id", example = "100001") @PathVariable("id") Long id) {
        return R.data(userRoleService.deleteById(id));
    }

}
